<?php
namespace App\Http\Controllers\blog\front;

use App\Http\Controllers\blog\LogController;
use Think\VerifyCode;
use Symfony\Component\HttpFoundation\Request;

class VerifyController extends LogController{

	public function verify(Request $request)
	{
		$config = array ( 'type' => 'web.login', 'config' => 'web.login');
        $query = \Crypt::encrypt($config);
        if (! empty($query)) {
            $param = \Crypt::decrypt($query);
            $config['web.login'] = array ( 'bg' => array ( 255, 255, 255 ), 'length' => 4, 'fontSize' => 16, 'imageW' => 150, 'imageH' => 36, 'useNoise' => false, 'fontttf' => '5.ttf' );
            $verifyCode = new VerifyCode($config[ $param['config'] ]);
            return response($verifyCode->entry($param['type']), 200, ['content-type' => 'image/png']);
        }
	}
}